# Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
# Maintainer: Ivy Foster <iff@archlinux.org>
# Contributor: Abdelhakim Qbaich <abdelhakim@qbaich.com>
# Contributor: korjjj <korjjj+aur@gmail.com>
# Contributor: TDY <tdy@archlinux.info>
# Contributor: Adam Ehlers Nyholm Thomsen <adament@gmail.com>
# Contributor: Nathan Jones <nathanj@insightbb.com>

pkgname=ledger
pkgver=3.3.2
pkgrel=2
pkgdesc='Double-entry accounting system with a command-line reporting interface'
arch=(i686 loong64 x86_64)
url='https://ledger-cli.org'
license=(BSD)
depends=(boost-libs libedit mpfr)
makedepends=(boost cmake python)
optdepends=(
	'emacs: emacs interface'
	'python: python library'
)
source=("ledger-$pkgver.tar.gz::https://github.com/ledger/ledger/archive/v$pkgver.tar.gz")
sha256sums=('555296ee1e870ff04e2356676977dcf55ebab5ad79126667bc56464cb1142035')

build() {
	cd "ledger-$pkgver"

	cmake . \
		-DCMAKE_INSTALL_PREFIX:PATH=/usr \
		-DUSE_PYTHON:BOOL=TRUE
	make
}

check() {
	make -C "ledger-$pkgver" check
}

package() {
	cd "ledger-$pkgver"

	make DESTDIR="$pkgdir" install
	install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/ledger/LICENSE.md"
}
